package com.yazi.mxz.common.entity.beans;

import com.myframework.smhj.hibernate.Entity;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.SEQUENCE;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * SpecType entity. @author MyEclipse Persistence Tools
 */
@javax.persistence.Entity
@Table(name = "MXZ_SPEC_TYPE", schema = "MXZ")
public class SpecType extends Entity implements java.io.Serializable {

	// Fields

	private Long specTypeId;
	private Category category;
	private StoreGoods storeGoods;
	private Goods goods;
	private String name;
	private Long sort;
	private Long updateTime;
	private Set<Spec> specs = new HashSet<Spec>(0);

	// Constructors

	/** default constructor */
	public SpecType() {
	}

	/** minimal constructor */
	public SpecType(String name, Long sort, Long updateTime) {
		this.name = name;
		this.sort = sort;
		this.updateTime = updateTime;
	}

	/** full constructor */
	public SpecType(Category category, StoreGoods storeGoods, Goods goods,
			String name, Long sort, Long updateTime, Set<Spec> specs) {
		this.category = category;
		this.storeGoods = storeGoods;
		this.goods = goods;
		this.name = name;
		this.sort = sort;
		this.updateTime = updateTime;
		this.specs = specs;
	}

	// Property accessors
	@SequenceGenerator(name = "generator", sequenceName = "SEQ_SPEC_TYPE")
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "SPEC_TYPE_ID", unique = true, nullable = false, precision = 15, scale = 0)
	public Long getSpecTypeId() {
		return this.specTypeId;
	}

	public void setSpecTypeId(Long specTypeId) {
		this.specTypeId = specTypeId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CAT_ID")
	public Category getCategory() {
		return this.category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "STORE_GOODS_ID")
	public StoreGoods getStoreGoods() {
		return this.storeGoods;
	}

	public void setStoreGoods(StoreGoods storeGoods) {
		this.storeGoods = storeGoods;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "GOODS_ID")
	public Goods getGoods() {
		return this.goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	@Column(name = "NAME", nullable = false, length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "SORT", nullable = false, precision = 15, scale = 0)
	public Long getSort() {
		return this.sort;
	}

	public void setSort(Long sort) {
		this.sort = sort;
	}

	@Column(name = "UPDATE_TIME", nullable = false, precision = 15, scale = 0)
	public Long getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Long updateTime) {
		this.updateTime = updateTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "specType")
	public Set<Spec> getSpecs() {
		return this.specs;
	}

	public void setSpecs(Set<Spec> specs) {
		this.specs = specs;
	}

}